#include <stdio.h>

void shuchu(int g,int s,int b,int q)
{
		printf("%d %d %d %d",q,b,s,g);
}

int main()
{
	int num;
	scanf("%d",&num);
	int g=num%10;
	int s=num%100/10;
	int b=num%1000/100;
	int q=num%10000/1000;
	shuchu(g,s,b,q);
	return 0;
}